<?php
/**
 * @version $Id$
 * @package    Jmonoslideshow
 * @author     Matthieu BARBE {@link http://www.ccomca.com}
 * @author     Created on 04-Sep-2009
 */

// Check to ensure this file is included in Joomla!
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
//require helper media
require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jmonoslideshow'.DS.'helpers'.DS.'media.php' );
class JFormFieldGetImageSize extends JFormField
{
	protected $type 		= 'GetImageSize';

	protected function getInput() {
	
		// Initialize some field attributes.
		$size		= ' size="6"';
		$class		= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
		$maxLength	= $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
		$readonly	= ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
		$disabled	= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		// Initialize JavaScript field attributes.
		$onchange	= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
		$value 		= htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
		if ($value == "" || $value == 0)
			{
				$value = MediaHelper::getSizeImageLimit();
			}
		$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
			   .$class.$size.$disabled.$readonly.$onchange.$maxLength.'/> px';		
		return $html;

	}
	
	protected function getLabel() {
		
		echo '<div class="clr"></div>';
		return parent::getLabel();
		echo '<div class="clr"></div>';
	}
	
}
?>